﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DotSpatial.Data;

using DotSpatial.Topology;

namespace HAGISV2
{
    [Serializable]
   public class LineShape:VectorShape
    {


        string _polyKey;
        /// <summary>
        /// 是否已转换为多边形  仅针对闭合线,非闭合线将始终返回true
        /// </summary>
        public string PolyKey
        {
            get
            {
                if (!_isEnClosed)
                    return "";
                return _polyKey;
            }
            //set
            //{
            //    if (_isEnClosed)
            //        _polyKey = value;
            //}
        }



        bool _isEnClosed;
        /// <summary>
        /// 图形是否闭合
        /// </summary>
        public bool IsEnClosed
        {
            get { return _isEnClosed; }
            set { _isEnClosed = value; }
        }

       public LineShape(string id,Coordinate[] coords):base(id)
       {
           this._polyKey = id;
           this._geometry = new LineString(coords);
       }

       public LineShape(string id, Coordinate[] coords, bool isEnClosed)
           : base(id)
       {
           this._isEnClosed = isEnClosed;
           this._polyKey = id;
           if (IsEnClosed)
           {
               this._geometry = new LinearRing(coords);
           }
           else
           {
               this._geometry = new LineString(coords);
           }

       }


       public LineShape(string id, IGeometry geometry):base(id)
       {
           this._polyKey = id;
           this._geometry = geometry;
       }


       



    


       
       
    }
}
